home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1987 February
/
Ahoy_Magazine_87-02_1987_Double_L.d64
/
digit decomp.128
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
337b
|
16 lines
0 rem << cd38-5 >>
1 rem commodares problem #34-3
2 rem digit decomposition
3 rem solution by
4 rem wallace leeker
5 rem
10 input "number";x :if x>1e10 then 10
20 for a=1 to 9 : y=int(x/10)
30 n(a)=x-(y*10) : su=su+n(a) : x=y
40 next a : b=10
50 (NULL) : b=b-1 : (NULL) (NULL) n(b)>0
55 if b=1 then 80
60 (NULL) : print n(b)"+"; : b=b-1
70 (NULL) (NULL) b=1
80 print n(1)"=";su